<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript">
        // || &&
        //||逻辑或
        var name1 = '';
        var name2 = 'name2';
        var name3 = 'name3';
        var name4 = 'name4';

        var newName = null;
        //判断
        if(name1){
            newName = name1;
        }else if(name2){
            newName = name2;
        }else if(name3){
            newName = name3;
        }else{
            newName = name4;
        }

        //新的做法
        newName = name1||name2||name3||name4;
        console.log(newName);

        //&& 逻辑与
        var age = 22;
        if(age>20){
            console.log('可以结婚啦');
        }

        //条件 && {
        //...
        //}
        (age > 20) && console.log('可以结婚了！！！！！！');

    </script>
</head>
<body>

</body>
</html>